package com.daiji.feixiang.adapter;

import com.daiji.feixiang.bean.CacheBean;
import com.daiji.feixiang.holder.CacheHolder;
import com.daiji.feixiang.holder.MyBaseViewHolder;

import java.util.ArrayList;

public class CacheAdapter extends MyBaseAdapter<CacheBean> {
    public CacheAdapter(ArrayList<CacheBean> data) {
        super(data);
    }


    @Override
    public void initView(CacheBean item, MyBaseViewHolder viewHolder) {
        CacheHolder cacheHolder = (CacheHolder) viewHolder;
        cacheHolder.tv_key.setText("key=" + item.key);
        cacheHolder.tv_value.setText("value=" + item.value);
        switch (item.type) {
            case 1:
                cacheHolder.tv_type.setText("类型：cookie");
                break;
            case 2:
                cacheHolder.tv_type.setText("类型：localStorage");
                break;
        }
    }

    @Override
    public CacheHolder getHolder() {
        return new CacheHolder();
    }
}
